#!/usr/bin/python3
import urllib.request
import urllib.parse
import ssl
import json
import re
import hashlib
import time
import demo








f = open('汉字.xml', 'r')  # 读模式
line = f.readline()
all = ''
while line:
  print(line)
  zhPattern = re.compile(r'>([\s\S].*?)<')
  match = zhPattern.findall(line)
  if len(match) != 0:
    zhPattern1 = re.compile(u'[\u4e00-\u9fa5]+')  # 查找汉字
    match1 = zhPattern1.search(match[0])
    if match1:
      print(match[0])
      text = match[0]
      all = all+'"'+match[0]+'"="' + text+'";'+"\r\n"
    else:
      print("本行没有汉字")
      all = all+line
  else:
    print("本行没有尖括号")
    all = all+line
  line = f.readline()
f.close()
strFile = open("汉字.txt", "r+")
read_data = strFile.read()
strFile.seek(0)
strFile.truncate()
strFile.write(all)
